package com.awesome.javademo.algorithm.tree;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.awesome.javademo.R;
import com.awesome.javademo.algorithm.tree.bean.TreeNode;
import com.awesome.javademo.algorithm.tree.bean.TreeNodeUtil;
import com.awesome.common.util.log.ShowLogUtil;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class TreeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tree);
        testLevelOrder();
    }

    /**
     * 测试层级遍历
     */
    private void testLevelOrder(){
        List<List<Integer>> lists = LevelOrder.levelOrder(TreeNodeUtil.getTreeNode());
        ShowLogUtil.info("start");
        for (List<Integer> list : lists) {
            for (Integer integer : list) {
                ShowLogUtil.info("integer = "+integer);
            }
            ShowLogUtil.info(" ");
        }
    }
}